﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL_MechSys;

namespace FORMS_MechSys
{
    public partial class frmAteLogo : Form
    {
        public frmAteLogo()
        {
            InitializeComponent();
            DimensionarLabelFuncionario(BLLUtilitarios.FuncionarioLogado);
            pictureBox21.BackColor = pictureBox22.BackColor = pictureBox23.BackColor = tlpTexto.BackColor =
            pictureBox27.BackColor = pictureBox26.BackColor = pictureBox25.BackColor = pictureBox24.BackColor =
            pictureBox28.BackColor = label1.ForeColor = pictureBox33.BackColor = pictureBox34.BackColor =
            this.tableLayoutPanel1.BackColor = tlpBemvindo.BackColor = tlpPrincipal.BackColor =
            new BLL_MechSys.BLLCor().Buscar("Principal").Cor;
            label2.ForeColor = label1.ForeColor = new BLL_MechSys.BLLCor().Buscar("Letra").Cor;
        }

        private void DimensionarLabelFuncionario(string funcionario)
        {
            if (string.IsNullOrWhiteSpace(funcionario))
                funcionario = "Modo de Administração";
            if (funcionario.Length > 24)
            {
                int indice = -1;
                char[] fun = funcionario.ToCharArray();
                for (int i = 23; i >= 0; i--)
                {
                    if (fun[i] == ' ')
                    {
                        indice = i;
                        break;
                    }
                }
                funcionario = funcionario.Substring(0, indice);
            }
            label2.Text = funcionario;
            label2.Margin = new System.Windows.Forms.Padding((int)((290 - label2.Width) / 2), 5, 3, 0);
        }
    }
}
